{{- define "title" -}}
路标 - {{ .Site.Title -}}
{{- end -}}

{{- define "content" -}}
{{- /* Sum Retrieval Page */ -}}
<div class="page archive retrieval">
    <h2 class="archive-title">
        <a href="{{ relURL "posts/" }}">所有文章</a>&nbsp;&nbsp;
        <a href="{{ relURL "tags/" }}">标签</a>&nbsp;&nbsp;
        <a href="{{ relURL "series/" }}">系列</a>&nbsp;&nbsp;
        <a href="{{ relURL "categories/" }}">分类</a>&nbsp;&nbsp;
        <a href="{{ relURL "gallery/" }}">画廊</a>&nbsp;&nbsp;
        <a href="{{ relURL "showcase/" }}">展示柜</a>&nbsp;&nbsp;
        <a href="{{ relURL "docs/" }}">文档</a>
    </h2>
    <hr />
    <h2><a href="{{ relURL "tags/" }}">标签</a></h2>
    <div class="tag-cloud-tags">
        {{- range $.Site.Taxonomies.tags.ByCount -}}
        <a href="{{ .Page.RelPermalink }}">{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
        {{- end -}}
    </div>
    <hr />
    <h2><a href="{{ relURL "series/" }}">系列</a></h2>
    {{- $terms := $.Site.Taxonomies.series.ByCount -}}
    <div>
        {{- range $terms -}}
        {{- $term := .Term -}}
        {{- $pages := .Pages -}}
        {{- $type := "series" -}}
        {{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
        <div class="card-item">
            <div class="card-item-wrapper">
                <h3 class="card-item-title">
                    <a href="{{ .RelPermalink }}">
                        <i class="far fa-folder fa-fw"></i>&nbsp;{{ .Page.Title }} <sup>{{- len $pages -}}</sup>
                    </a>
                </h3>
                {{- range first 5 $pages -}}
                <article class="archive-item">
                    <a href="{{ .RelPermalink }}" class="archive-item-link">
                        {{- .Title -}}
                    </a>
                </article>
                {{- end -}}
                {{- if gt (len $pages) 3 -}}
                <span class="more-post">
                    <a href="{{ .RelPermalink }}" class="more-single-link">{{ T "more" }} >></a>
                </span>
                {{- end -}}
            </div>
        </div>
        {{- end -}}
        {{- end -}}
    </div>
    <hr />
    <h2><a href="{{ relURL "categories/" }}">分类</a></h2>
    {{- $terms := $.Site.Taxonomies.categories.ByCount -}}
    <div>
        {{- range $terms -}}
        {{- $term := .Term -}}
        {{- $pages := .Pages -}}
        {{- $type := "categories" -}}
        {{- with $.Site.GetPage "taxonomy" (printf "%v/%v" $type $term) -}}
        <div class="card-item">
            <div class="card-item-wrapper">
                <h3 class="card-item-title">
                    <a href="{{ .RelPermalink }}">
                        <i class="far fa-folder fa-fw"></i>&nbsp;{{ .Page.Title }} <sup>{{- len $pages -}}</sup>
                    </a>
                </h3>
                {{- range first 10 $pages -}}
                <article class="archive-item">
                    <a href="{{ .RelPermalink }}" class="archive-item-link">
                        {{- .Title -}}
                    </a>
                </article>
                {{- end -}}
                {{- if gt (len $pages) 10 -}}
                <span class="more-post">
                    <a href="{{ .RelPermalink }}" class="more-single-link">{{ T "more" }} >></a>
                </span>
                {{- end -}}
            </div>
        </div>
        {{- end -}}
        {{- end -}}
    </div>
    <!-- 未分类 -->
    <div>
        {{ $uncategorized := where .Site.RegularPages "Type" "!=" "page" }}
        {{- $pages := slice -}}
        {{- range $uncategorized -}}
        {{ $cat := (printf "%v" .Params.categories ) }}
        {{ if ne $cat "<nil>" | eq $cat "[]" }}
            {{ $pages = $pages | append . }}
            {{- end -}}
            {{- end -}}
            <div class="card-item">
                <div class="card-item-wrapper">
                    <h3 class="card-item-title">
                        <a>
                            <i class="far fa-folder fa-fw"></i>&nbsp;未分类 <sup>{{- len $pages -}}</sup>
                        </a>
                    </h3>
                    {{- range $pages -}}
                    <article class="archive-item">
                        <a href="{{ .RelPermalink }}" class="archive-item-link">
                            {{- .Title -}}
                        </a>
                    </article>
                    {{- end -}}
                </div>
            </div>
    </div>
</div>

{{- end -}}